package com.better517na.stateprocess.state.impl;

import com.better517na.stateprocess.annotion.OrderProcessor;
import com.better517na.stateprocess.model.CreateOrderContext;
import com.better517na.stateprocess.model.ServiceResult;
import com.better517na.stateprocess.model.StateContext;
import com.better517na.stateprocess.model.common.OrderEventEnum;
import com.better517na.stateprocess.model.common.OrderSceneEnum;
import com.better517na.stateprocess.model.common.OrderStatusEnum;
import com.better517na.stateprocess.model.common.OrderTypeEnum;

@OrderProcessor(state = {OrderStatusEnum.Dispatch}, orderType = {OrderTypeEnum.REALTIME}, orderScene = {OrderSceneEnum.Enterprise},event = {OrderEventEnum.Call_Back_Accept})
public class OrderDriverAcceptProcessor extends AbstractStateProcessor<String, CreateOrderContext> {

    @Override
    public void prepare(StateContext<CreateOrderContext> context) {
        super.prepare(context);
    }

    @Override
    public ServiceResult<String> check(StateContext<CreateOrderContext> context) {
        System.out.println("订单接驾处理检查完成");
        return null;
    }

    @Override
    public Boolean isLock(StateContext<CreateOrderContext> context) {
        return null;
    }

    @Override
    public String getNextState(StateContext<CreateOrderContext> context) {
        System.out.println("获取下一个状态成功:" + OrderStatusEnum.Accepted.getDesc());
        return null;
    }

    @Override
    public ServiceResult<String> action(String nextState, StateContext<CreateOrderContext> context) throws Exception {
        System.out.println("司机应答成功");
        return null;
    }

    @Override
    public ServiceResult<String> save(String nextState, StateContext<CreateOrderContext> context) throws Exception {
        System.out.println("司机应答入库成功");
        return null;
    }

    @Override
    public void after(StateContext<CreateOrderContext> context) {

    }
}
